package com.fulihui.wgj.schedule.job;

import com.alibaba.dubbo.config.annotation.Reference;
import com.fulihui.common.result.rpc.BaseResult;
import com.fulihui.wgj.facade.service.uv.WxUserMarkInfoService;
import com.fulihui.wgj.schedule.annotation.MutexLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 用户点击UV统计
 *
 * @author wang_wx
 * @date 2018-08-09
 */
@Component
public class WxUserMarkUvRecordJob {

    private static final Logger LOGGER = LoggerFactory.getLogger(WxUserMarkUvRecordJob.class);

    @Reference(version = "1.0.0")
    WxUserMarkInfoService wxUserMarkInfoService;

    @MutexLock(node = "${job.node.wxUserMarkUvRecordJob_execute}")
    @Scheduled(cron = "${job.cron.wxUserMarkUvRecordJob_execute}")
    public void execute() {
        LOGGER.info("WxUserMarkUvRecordJob start");
        BaseResult baseResult = wxUserMarkInfoService.countUvAndStorage();
        if (baseResult.isSuccess()) {
            LOGGER.info("WxUserMarkUvRecordJob执行成功！");
        } else {
            LOGGER.info("WxUserMarkUvRecordJob执行失败！");
        }
    }

}
